﻿Ext.define('MyApp.users.Employee', {
    extend: 'Ext.util.Observable',
    attempts: 0,
    constructor: function () {
        this.addEvents('success', 'fail');
        this.callParent();
    },
    login: function (usr, pwd) {
        var me = this;
        Ext.Msg.wait('Por favor espere', 'Cargando....', {
            interval: 300
        });

        setTimeout(function () {
            Ext.Msg.hide();
            me.attempts++;
            if (usr == 'cesar' && pwd == 'bocanegra') {
                me.fireEvent('success', me);
            } else {
                me.fireEvent('fail', me.attempts);
            }
        },3000);
    }
});